<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:c="http://java.sun.com/jsp/jstl/core">

<ui:composition
	template="#{webGlobal.url_template}/administration/main.xhtml">
	<ui:define name="head">

	</ui:define>

	<ui:define name="content">

		<div class="panel panel-default">
			<div class="panel-heading">
				<h:outputLabel value="#{adminEdit.tournament.name}"> - Liste des matchs en préparation</h:outputLabel>
			</div>

			<table class="table">
				<thead>
					<tr>
						<th>Tour</th>
						<th>Match</th>
						<th>Equipes</th>
					</tr>
				</thead>
				<tbody>
					<ui:repeat var="match" value="#{adminEdit.listMatchsInPreparation}">
						<tr>
							<td>#{match.roundNumber}</td>
							<td>#{match.matchNumber}</td>
							<td>#{match.homeTeam.name} - #{match.outsideTeam.name}</td>
						</tr>
					</ui:repeat>
					<tr></tr>
				</tbody>
			</table>
		</div>

		<div class="panel panel-default">
			<div class="panel-heading">
				<h:outputLabel value="#{adminEdit.tournament.name}"> - Liste des arbitres</h:outputLabel>
			</div>

			<table class="table">
				<thead>
					<tr>
						<th>Prénom</th>
						<th>Nom</th>
						<th>Matchs</th>
						<th>Actions</th>
					</tr>
				</thead>
				<tbody>
					<ui:repeat var="referee" value="#{adminEdit.listReferee}">
						<tr>
							<td>#{referee.firstName}</td>
							<td>#{referee.lastName}</td>
							<td>#{referee.listMatchs.size()}</td>
							<td><h:form prependId="false">
									<h:commandButton action="#{adminEdit.deleteReferee(referee)}"
										image="#{webGlobal.url_module}/tournament/img/delete-icon.png"
										style="height: 20px;">
									</h:commandButton>
								</h:form>
							</td>
						</tr>
					</ui:repeat>
					<tr></tr>
				</tbody>
			</table>
		</div>

		<div class="panel panel-default">
			<div class="panel-heading">
				<h:outputLabel> Ajouter un arbitre à ce tournoi</h:outputLabel>
			</div>

			<h:form id="addReferee" prependId="false">
				<h:outputLabel for="firstNameReferee">Prenom</h:outputLabel>
				<h:message for="firstNameReferee" style="color: red;" />
				<h:inputText id="firstNameReferee" label=" "
					styleClass="form-control" required="true"
					value="#{adminEdit.newReferee.firstName}">
				</h:inputText>

				<h:outputLabel for="lastNameReferee">Nom</h:outputLabel>
				<h:message for="lastNameReferee" style="color: red;" />
				<h:inputText id="lastNameReferee" label=" "
					styleClass="form-control" required="true"
					value="#{adminEdit.newReferee.lastName}">
				</h:inputText>

				<br />

				<h:commandButton value="Ajouter arbitre"
					styleClass="btn btn-lg btn-primary btn-block"
					action="#{adminEdit.addReferee()}">
				</h:commandButton>
			</h:form>
		</div>


	</ui:define>
</ui:composition>
</html>